import { defHttp } from '/@/utils/http/axios'

enum Api {
  Page = '/blogInfo/page',
  Add = '/blogInfo/add',
  Update = '/blogInfo/update',
  Deatail = '/blogInfo/detail',
}

export function page(param) {
  return defHttp.get<any>({ url: Api.Page, params: param }, { urlPrefix: '/blog' })
}

export function add(param) {
  return defHttp.post<null>(
    { url: Api.Add, params: param },
    { urlPrefix: '/blog', errorMessageMode: 'modal', successMessage: 'message' },
  )
}

export function update(param) {
  return defHttp.post<null>(
    { url: Api.Update, params: param },
    { urlPrefix: '/blog', errorMessageMode: 'modal', successMessage: 'message' },
  )
}

export function detail(id) {
  return defHttp.get<any>({ url: Api.Deatail, params: { id } }, { urlPrefix: '/blog' })
}
